BEEP

Syntax: BEEP length, pitch [,pitch_2, grd_x, grd_y [,wrap [,fuzz [,rndom ]]]]
    or: BEEP
Location: QL ROM

This command allows you to access the QL's rather poor sound generation chip. It can be extremely difficult to use this command, and a lot of trial and error will generally be needed before you can find anything similar to the sound you are after.

BEEP without any parameters will turn off the sound altogether. You must also be aware of the fact that as soon as a BEEP command is encountered, the QL will cancel the current sound and emit the new one (whether or not the earlier sound had finished).

Each of the various parameters have different ranges and different effects on the sound produced:

length          Specifies the duration of the sound in 72 microsecond
                units.
                length=0 means emit the sound indefinitely.

pitch           This affects the tone of the sound produced.  The
                allowable range is 0...255.
                A pitch of 0 is the highest tone.

pitch_2         This represents a second pitch level, which will have no
                effect if this is the same (or lower) than pitch.
                If however, the value of this parameter is higher than
                that of pitch, this specifies a range between which the
                sound can 'bounce' by use of the next two parameters,
                creating a sequence of notes.

grd_x           Specifies the time interval (in 72 microsecond units)
                of each note in the sequence.
                The permitted range is 0...32767.

grd_y           Specifies the step between each note in the sequence.
                Range 0...15.
                However, this may make more sense if the correct range
                was said to be -7..8.
  
                A value of zero produces no step.

                A value of 1..7 means that each note will be that many
                pitches below the last one.

                A value of 8 makes the BEEP command fit as many notes
                into the sequence as possible.

                Values of 9 to 15 (or -7 to -1) mean that each note will
                be that many pitches above the last one
                (these correspond to the values 7 to 1 respectively).

                When the top or bottom of the range is reached, the step
                direction is reversed to cause the sound to 'bounce'.

wrap            If specified, the range of notes between the two pitch
                parameters will be repeated the specified number of
                times before the step direction is altered.
                Range is 0..15.
  
                The last note in the range will not be sounded, but will
                appear as the first note in the opposite direction.

fuzz            This affects the purity of each note, by blurring its
                sound. The effective range is 8...15, with a value of 15
                producing an awful buzz.

rndom           This parameter allows you to specify a certain amount of
                'randomness' which is to be added to each note.
                The effective range is once again 8...15, with the given
                value being used to alter from how far away from the
                original sequence the QL can pick a note.

Example:

BEEP 0,20,40,10070,2

will keep sounding every other note between 20 and 40 moving down and then up the scale.

NOTE:
BEEP does not work on ST/QLs or the Amiga-QDOS Emulator (pre v3.23).

The pitch of the sound is actually shifted on QLs by different values of length, fuzz and rndom. The length of the sound is also somewhat dependent on the pitch!  Both of these problems are however fixed by the replacement co-processor Hermes.

CROSS-REFERENCE:
BEEPING allows you to check if a sound is currently being emitted.
PAUSE allows you to specify a time interval during which the computer will wait (allowing you to play much longer notes).
